/*
 *  $Id: IceCrystals.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Water.Spells {
    public class IceCrystals: SpellCard {
        public IceCrystals(): base("001_w_s_ice_crystals") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Water;
            Value = 100;
            AddManaCost(ElementType.Water, 3);
        }

        private static readonly Languages.CardPhrase<IceCrystals> Action = new Languages.CardPhrase<IceCrystals>("action");

        public override void DoAction(TargetArgs args) {
            int count = 0;
            foreach (Creature cr in args.Player.Enemy.GetCreatures()) {
                int dmg = cr.DamageBy(NewDamage(args, 1));
                if (dmg > 0 && !cr.IsDeath)
                    if (args.Player.Game.GetDiceNextValue() >= 4) {
                        cr.State = CreatureState.Tapped;
                        count++;
                    }
            }
            if (count > 0)
                args.Player.Game.Log.Add(Action.Phrase, count);
        }
    }
}
